package com.dzsw.javabase.file;

import org.apache.tika.Tika;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class ContentTypeDemo {

    public static void main(String[] args) throws IOException {
        Tika tika = new Tika();
        String ss = "D:\\TOSSJAVA\\config\\toss_stamp\\1741590270009.xls";
        String s = "111\n222\n333\n444\n555\n666";
        File file = new File(ss);
        String ct = tika.detect(new FileInputStream(file));
        System.out.println(ct);
        ct = tika.detect(new ByteArrayInputStream(s.getBytes("UTF-8")));
        System.out.println(ct);
    }
}
